package com.fanjun.learning.multithread.ATM;

/**
 * Created by memedai on 2016/10/13.
 */
public class WithdrawThread extends Thread{
    private final ATM atm;
    public WithdrawThread(String name, ATM atm) {
        super(name);
        this.atm = atm;
    }

    @Override
    public void run(){
        for (int i = 0 ; i< 50 ;i++){
            atm.withdraw();
            try {
                sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
